﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SmartCity.ProcessEngine.Infrastructure.Interfaces
{
    public interface IBaseRepository<T>
    {
        /// <summary>
        /// 数据库上下文
        /// </summary>
        DataDbContext DB { get; }
        Task<int> AddAsync(T t);
        /// <summary>
        /// 批量添加
        /// </summary>
        /// <param name="list">实体集合</param>
        /// <returns>返回受影响行数</returns>
        Task<int> AddRangeAsync(List<T> list);
        Task<int> UpdateAsync(T t);
        /// <summary>
        /// 批量更新
        /// </summary>
        /// <param name="list">实体集合</param>
        /// <returns>返回受影响行数</returns>
        Task<int> UpdateRangeAsync(List<T> list);
        //Task<int> DeleteAsync(int id);
        //Task<int> DeleteRangeAsync(List<T> list);
        Task<T> FindAsync(int id);
        IQueryable<T> GetAll();
    }
}
